package com.woniuxy.creditsystem.statisticsmag.controller;

import com.github.pagehelper.PageInfo;
import com.woniuxy.creditsystem.common.bean.FinanceInfo;
import com.woniuxy.creditsystem.common.bean.UserConversionInfo;
import com.woniuxy.creditsystem.statisticsmag.page.PageRequest;
import com.woniuxy.creditsystem.statisticsmag.page.TableResult;
import com.woniuxy.creditsystem.statisticsmag.service.IUserConversionService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 用户转化controller
 *
 * @author 刘川
 */
@RequestMapping("/usercon")
@RestController
public class UserConversionController {
    @Resource
    private IUserConversionService userConversionServiceImpl;

    @RequestMapping("/page")
    public TableResult<UserConversionInfo> findAllByParams(PageRequest request, UserConversionInfo userConversionInfo) {
        System.out.println(request);
        System.out.println(userConversionInfo);

        PageInfo<UserConversionInfo> pageInfo = userConversionServiceImpl.findAllByParams(request, userConversionInfo);
        System.out.println(pageInfo);
        return new TableResult<UserConversionInfo>(pageInfo.getTotal(),pageInfo.getList());

    }
    @RequestMapping("/def")
    public TableResult<UserConversionInfo> findDefByParams(PageRequest request, UserConversionInfo userConversionInfo) {
        System.out.println(request);
        System.out.println(userConversionInfo);

        PageInfo<UserConversionInfo> pageInfo = userConversionServiceImpl.findDefByParams(request, userConversionInfo);
        System.out.println(pageInfo);
        return new TableResult<UserConversionInfo>(pageInfo.getTotal(),pageInfo.getList());
    }

        @RequestMapping("/one")
        public UserConversionInfo findDefOne(UserConversionInfo userConversionInfo){
            System.out.println(userConversionInfo);
           return userConversionServiceImpl.findDefOne(userConversionInfo);
        }
}
